const mongoose = require('mongoose')

const db = mongoose.connection

// 权限登录 连接数据库
mongoose.connect('mongodb://admin:123456@127.0.0.1:27017/test?authSource=admin', {
	useNewUrlParser: true,
	useUnifiedTopology: true
})
// mongoose.connect('mongodb://localhost:27017/test');
db.on('error', console.error.bind(console, 'connection error:'))

const spiderSchema = mongoose.Schema({
	id: Number,
	name: String,
	updateTime: String
})

const Spider = mongoose.model('movies', spiderSchema)

exports.Spider = Spider
